/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package view.jPanels;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 *
 * @author Gean
 */
@Entity
@Table(name = "sala", catalog = "", schema = "")
@NamedQueries({
    @NamedQuery(name = "Sala.findAll", query = "SELECT s FROM Sala s"),
    @NamedQuery(name = "Sala.findByIdPredio", query = "SELECT s FROM Sala s WHERE s.salaPK.idPredio = :idPredio"),
    @NamedQuery(name = "Sala.findByIdSala", query = "SELECT s FROM Sala s WHERE s.salaPK.idSala = :idSala"),
    @NamedQuery(name = "Sala.findByNomeSala", query = "SELECT s FROM Sala s WHERE s.nomeSala = :nomeSala"),
    @NamedQuery(name = "Sala.findByUtilizacao", query = "SELECT s FROM Sala s WHERE s.utilizacao = :utilizacao")})
public class Sala implements Serializable {
    @Transient
    private PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected SalaPK salaPK;
    @Basic(optional = false)
    @Column(name = "NomeSala")
    private String nomeSala;
    @Basic(optional = false)
    @Column(name = "Utilizacao")
    private String utilizacao;

    public Sala() {
    }

    public Sala(SalaPK salaPK) {
        this.salaPK = salaPK;
    }

    public Sala(SalaPK salaPK, String nomeSala, String utilizacao) {
        this.salaPK = salaPK;
        this.nomeSala = nomeSala;
        this.utilizacao = utilizacao;
    }

    public Sala(int idPredio, int idSala) {
        this.salaPK = new SalaPK(idPredio, idSala);
    }

    public SalaPK getSalaPK() {
        return salaPK;
    }

    public void setSalaPK(SalaPK salaPK) {
        this.salaPK = salaPK;
    }

    public String getNomeSala() {
        return nomeSala;
    }

    public void setNomeSala(String nomeSala) {
        String oldNomeSala = this.nomeSala;
        this.nomeSala = nomeSala;
        changeSupport.firePropertyChange("nomeSala", oldNomeSala, nomeSala);
    }

    public String getUtilizacao() {
        return utilizacao;
    }

    public void setUtilizacao(String utilizacao) {
        String oldUtilizacao = this.utilizacao;
        this.utilizacao = utilizacao;
        changeSupport.firePropertyChange("utilizacao", oldUtilizacao, utilizacao);
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (salaPK != null ? salaPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Sala)) {
            return false;
        }
        Sala other = (Sala) object;
        if ((this.salaPK == null && other.salaPK != null) || (this.salaPK != null && !this.salaPK.equals(other.salaPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "view.jPanels.Sala[ salaPK=" + salaPK + " ]";
    }

    public void addPropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.addPropertyChangeListener(listener);
    }

    public void removePropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.removePropertyChangeListener(listener);
    }
    
}
